package shiyan4;

import java.util.List;
import java.util.Scanner;

public class Test {

	public static void main(String[] args) {
		Student student1 = new Student(100001, "前前");
		Student student2 = new Student(100001, "银银");
		ClassRoom computerRoom = new ClassRoom("computerRoom001", "计算机网络实验室");
		ClassRoom compositionRoom = new ClassRoom("compositionRoom001", "组成原理实验室");

		Calculate.DistributionRoom(student1, computerRoom);
		Calculate.DistributionRoom(student2, compositionRoom);

		// 计算机网络实验室优秀次数
		int computerExcellentCount = 4;
		int computerPassCount = Calculate.weekCount - computerExcellentCount;
		System.out.println("计算机网络实验室优秀次数:" + computerExcellentCount);
		System.out.println("计算机网络实验室合格次数:" + computerPassCount);
		List<?> computerStudentList = Calculate.roomStudentMap.get(computerRoom.getId());
		if (computerStudentList != null) {
			for (int i = 0; i < computerStudentList.size(); i++) {
				Student student = (Student) computerStudentList.get(i);
				student.setEccellentCount(student.getExcellentCount() + computerExcellentCount);
				student.setPassCount(i);
			}
		}

		// 组成原理实验室优秀次数
				int compositionExcellentCount = 5;
				int compositionPassCount = Calculate.weekCount - compositionExcellentCount;
				System.out.println("组成原理实验室优秀次数:" + compositionExcellentCount);
				System.out.println("组成原理实验室合格次数:" + compositionPassCount);

				List<?> compositionStudentList = Calculate.roomStudentMap.get(compositionRoom.getId());
				if (compositionStudentList != null) {
					for (int i = 0; i < compositionStudentList.size(); i++) {
						Student student = (Student) compositionStudentList.get(i);
						student.setEccellentCount(student.getExcellentCount() + compositionExcellentCount);
						student.setPassCount(student.getPassCount() + compositionPassCount);
					}
				}

				System.out.println("请输入国家最新纳税标准:");
				Scanner scanner = new Scanner(System.in);
				while (true) {
					try {
						Calculate.taxRate = Double.parseDouble(scanner.next());
						break;
					} catch (Exception e) {
						System.err.println("纳税标准输入格式不正确");
						System.out.println("请输入国家最新纳税标准:");
					}
				}
				Calculate.calculateAccout(student1);
				Calculate
				.calculateAccout(student2);
			}

		}